import React, { Suspense } from 'react'
import { Spin } from 'antd'

/**
 * @description 路由懒加载方法
 */
const lazyLoad = (Element: React.LazyExoticComponent<React.ComponentType<any>>): React.ReactNode => {
  return <Suspense
    fallback={<Spin
      size="large"
      style={{
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        height: "100%"
      }}
    />}
  >
    <Element />
  </Suspense>
}

export default lazyLoad